<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Manage Perspective</title>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
//Load jQuery
google.load("jquery", "1.3.1");

google.setOnLoadCallback(function () {
	$("#btn_save_perspective").click(function(e) {
		$.ajax({
			type: "POST",
			url: "perspective.do?" + (new Date()).getTime(),
			cache: false,
			dataType : "json",
			data: $("#form_crud_perspective").serialize(),
			success: function(data) {
				if (data.error != null) {
					alert("An error occurred: "+ data.error);
				} else {
					$("#form_crud_perspective > input[name='action']").val("update");
					$("#form_crud_perspective > input[name='perspID']").val(data.perspID);
					alert("Data was stored!");
				}
			}
		});
	});
});
</script>
</head>
<body>
<h1>Manage Perspectives</h1>
<br>
<form action="" id="form_crud_perspective">
	<table>
		<tr><td>Name:</td><td><input type="text" name="name"></td></tr>
		<tr><td>Description:</td><td><input type="text" name="description"></td></tr>
		<tr><td>Initials:</td><td><input type="text" name="initials"></td></tr>
	</table>
	<input type="hidden" name="action" value="insert">
	<input type="hidden" name="perspID" value="">
	<input type="button" value="Save" id="btn_save_perspective">
</form>
</body>
</html>